import React, { PureComponent,Fragment } from "react";
import { connect } from "dva";
import { Row, Col, Upload, Spin } from "antd";
import DescriptionList from '../../../components/DescriptionList';
import styles from '../../Pbulic.less';

const { Description } = DescriptionList;

@connect(state => ({
  detaildata:state.equipment_maintain.detaildata,
  loading:state.equipment_maintain.loading.detailinfo,
}))
export default class DetailInfo extends PureComponent {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const { detailInfoId, dispatch} = this.props;
    dispatch({
      type: "equipment_maintain/fetch_maintain_info",
      payload: {
        maintenanceId: detailInfoId
      }
    });
  }




  render() {
    const { detaildata,loading } = this.props;

    return (
      <Fragment>
        {loading && <div className={"globalSpin"}><Spin spinning={loading}  /></div>}
        {
          !loading && detaildata && detaildata.maintenanceId &&
          <DescriptionList col={1} size="large" style={{ marginBottom: 32 }}>
            <Description term="单位名称">{detaildata.maintenanceName}</Description>
            <Description term="地址">{detaildata.mainAddress}</Description>
            <Description term="联系人">{detaildata.linkman}</Description>
            <Description term="联系电话">{detaildata.phone}</Description>
            <Description term="邮箱">{detaildata.email}</Description>
            <Description term="传真">{detaildata.fax}</Description>
            <Description term="备注">{detaildata.remarks}</Description>
          </DescriptionList>

        }
      </Fragment>
    );
  }
}
